# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1312580537.201599
_template_filename='/home/bastian/workspaces/c-chrysalide/trunk/portal/portal/templates/chatapp/chatapp.mako'
_template_uri='/chatapp/chatapp.mako'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding='utf-8'
from webhelpers.html import escape
_exports = ['title']


def _mako_get_namespace(context, name):
    try:
        return context.namespaces[(__name__, name)]
    except KeyError:
        _mako_generate_namespaces(context)
        return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
    pass
def _mako_inherit(template, context):
    _mako_generate_namespaces(context)
    return runtime._inherit_from(context, u'/index.mako', _template_uri)
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n')
        # SOURCE LINE 2
        __M_writer(u'\n<div id="content">\n\n <h1>chat powered by <a href="http://code.google.com/p/cogen/">cogen</a></h1>\n\t    <form name="chat">\n\t    <textarea id="ouput" name="output" rows="10" cols="80" readonly="readonly"></textarea><br/>\n\t    <input id="tosend" name="tosend" value="" size="80"/>\n\t    </form>\n</div>\t    \n\t<script language="javascript">\n\t    function xhr(url, callback, data) {\n\t        var req = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject(\'Microsoft.XMLHTTP\');\n\t        req.onreadystatechange = function() {\n\t            if (req.readyState == 4) {\n\t                if (callback) callback(req);\n\t            }\n\t        }\n\t        req.open(data?"POST":"GET", url, true);\n\t        req.send(data);\n\t    }\n\t    \n\t    \n\t    function pull(req) {\n\t        if(req.status == 200) {\n\t            document.chat.output.value = req.responseText + document.chat.output.value;\n\t            xhr(\'/chatapp/pull\', pull)\n\t        } else {\n\t            alert(req.responseText);\n\t        }\n\t    }\n\t    \n\t    \n\t    xhr(\'/chatapp/pull\', pull);\n\t    \n\t    \n\t    document.chat.tosend.onkeydown = function (event) {\n\t        event = event || window.event;\n\t        var key = event.which || event.keyCode;\n\t        if (key == 13) {\n\t            xhr(\'/chatapp/push\', null, document.chat.tosend.value);\n            document.chat.tosend.value = \'\';\n\t        }\n\t    }\n\t    \n\t    \n\t    document.chat.onsubmit = function() { return false; }\n\t</script>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_title(context):
    context.caller_stack._push_frame()
    try:
        __M_writer = context.writer()
        # SOURCE LINE 2
        __M_writer(u'Compagnie-Chrysalide - Chqt')
        return ''
    finally:
        context.caller_stack._pop_frame()


